#################################
###     Scripted Triggers     ###
#################################

# ROOT comments document the caller contract; nested blocks may change scope
# Each section or trigger must document its expected ROOT scope

#################
# Country Scope #
#################

# True if the country owns a sapient biological/lithoid/organic-robutt species that is not currently set to purge
# ROOT = country
lv_country_has_non_purged_biologically_functional_species = {

	any_owned_species = {
		is_sapient = yes
		OR = {
			is_archetype = BIOLOGICAL
			is_archetype = LITHOID

			# LV species trigger: allows qualifying robuttic species with functional organic parts
			lv_is_a_smexy_robutt = yes
		}
		NOR = {
			has_citizenship_type = { country = prev type = citizenship_purge }
			has_citizenship_type = { country = prev type = citizenship_purge_machine }
		}
	}

}

# Use for biological-pop-related technology potential
# ROOT = country
lv_country_can_access_biological_pop_tech = {

	OR = {
		# Normal non-Machine-Intelligence empires
		NOT = { has_authority = auth_machine_intelligence }

		# Machine Intelligence exceptions that are explicitly built around keeping/using bio pops
		has_valid_civic = civic_machine_assimilator
		has_valid_civic = civic_machine_servitor
		has_valid_civic = civic_machine_guided_sapience

		# Safety net for future/modded cases where a country really has non-purged organic species
		lv_country_has_non_purged_biologically_functional_species = yes
	}

}

# Is some form of breeder hive (submod)
# ROOT = country
lv_is_breeder_hive = {

	# Optional breeder-hive submod should overwrite this trigger
	# always = no
	OR = {
		has_valid_civic = civic_lv_nymphic_hosts
		has_valid_civic = civic_lv_propagating_throng
		has_valid_civic = civic_lv_brood_swarm
	}
}

# Uses LV Sex-Trophy system
# ROOT = country
lv_uses_sex_trophy_system = {

	has_valid_civic = civic_machine_servitor
	is_hospitality_servitor_empire = no

}

# Can use LV Sexbot Drone infrastructure
# ROOT = country
lv_can_use_sexbot_drone_infrastructure = {

	is_machine_empire = yes
	has_country_flag = lv_has_smexy_robutt_workforce

}

# True if the country owns at least one active aggressive invasive breeder
# ROOT = country
lv_country_has_aggressive_invasive_species = {

	any_owned_pop_group = { lv_is_valid_aggressive_invasive_parent = yes }

}

# True if the country owns at least one active seductive invasive breeder
# ROOT = country
lv_country_has_seductive_invasive_species = {

	any_owned_pop_group = { lv_is_valid_seductive_invasive_parent = yes }

}

# True if the country owns either invasive reproductive phenotype
# ROOT = country
lv_country_has_invasive_breeding_species = {

	OR = {
		lv_country_has_aggressive_invasive_species = yes
		lv_country_has_seductive_invasive_species = yes
	}

}

############################
# Country Scope Overwrites #
############################

# Added LV origins
# Intentional vanilla scripted-trigger overwrite
# ROOT = country
has_encountered_other_species = {

	OR = {

		# LV
		has_origin = origin_lv_parallel_evolution
		has_origin = origin_lv_sadomasochistic_evolution
		has_origin = origin_lv_symbiotic_evolution
		has_origin = origin_lv_invasive_breeders

		# Base game
		has_origin = origin_syncretic_evolution
		has_origin = origin_necrophage
		has_origin = origin_payback
		has_civic = civic_machine_servitor
		num_communications > 0
		any_owned_species = {
			NOT = { has_trait = "trait_mechanical" }
			NOT = { is_same_species = prev }
		}

	}

}

###############
# Owned Scope #
###############

# Broad owned-object callers that reach country state through owner.

# Can be worker check
# ROOT = owned scope (planet/colony/pop_group/job)
lv_worker_trigger = {

	hidden_trigger = { exists = owner }
	owner = { is_gestalt = no }

}

# Is Lithoid empire check
# ROOT = owned scope (planet/colony/pop_group/job)
lv_is_lithoid_empire = {

	exists = owner
	owner = { is_lithoid_empire = yes }

}

# Is Infernal empire check
# ROOT = owned scope (planet/colony/pop_group/job)
lv_is_infernal_empire = {

	exists = owner
	owner = { is_infernal_empire = yes }

}

# Is Robutt empire
# ROOT = owned scope (planet/colony/pop_group/job)
lv_is_robutt_empire = {

	exists = owner
	owner = { is_robot_empire = yes }

}

# Robutt empire and not catalytic food malus check
# ROOT = owned scope (planet/colony/pop_group/job)
lv_is_robutt_empire_is_not_catalytic_empire = {

	exists = owner
	owner = {
		is_robot_empire = yes
		is_catalytic_empire = no
	}

}

# Has agrarian idyll civic, doesn't have dystopian society
# ROOT = owned scope (planet/colony/pop_group/job)
lv_agrarian_idyll_not_dystopian_society = {

	exists = owner
	owner = {
		has_valid_civic = civic_agrarian_idyll
		NOT = {
			has_valid_civic = civic_dystopian_society
		}
	}

}

# Doesn't have dystopian society
# ROOT = owned scope (planet/colony/pop_group/job)
lv_not_dystopian_society = {

	owner? = { NOT = { has_valid_civic = civic_dystopian_society } }

}

# Has nurture protocols civic
# ROOT = owned scope (planet/colony/pop_group/job)
lv_has_machine_nurture_protocols = {

	exists = owner
	owner = { has_valid_civic = civic_lv_machine_nurture_protocols }

}

# Breeding active is gestalt
# ROOT = owned scope (planet/colony/pop_group/job)
lv_is_gestalt = {

	exists = owner
	owner = { is_gestalt = yes }

}

# Use for biological-pop-related building potential checks
# ROOT = owned scope (planet/colony/pop_group/job)
lv_planet_owner_can_access_biological_pop_tech = {

	exists = owner
	owner = { lv_country_can_access_biological_pop_tech = yes }

}

# Breeder job upkeep organic
# ROOT = owned scope (planet/colony/pop_group/job)
lv_breeder_upkeep_organic = {

	exists = owner
	lv_planet_owner_can_access_biological_pop_tech = yes
	owner = { is_lithoid_or_infernal_empire = no }

}

# Breeder job upkeep lithoid
# ROOT = owned scope (planet/colony/pop_group/job)
lv_breeder_upkeep_lithoid = {

	exists = owner
	lv_planet_owner_can_access_biological_pop_tech = yes
	owner = {
		is_lithoid_empire = yes
		is_infernal_empire = no
	}

}

# Breeder job upkeep infernal
# ROOT = owned scope (planet/colony/pop_group/job)
lv_breeder_upkeep_infernal = {

	exists = owner
	lv_planet_owner_can_access_biological_pop_tech = yes
	owner = { is_infernal_empire = yes }

}

# Breeder job upkeep robutt
# ROOT = owned scope (planet/colony/pop_group/job)
lv_breeder_upkeep_robutt = {

	exists = owner
	owner = { is_machine_empire = yes }

}

################
# Planet Scope #
################

# Planet has some form of beasties on it
# ROOT = planet
lv_beasties_on_planet = {

	OR = {
		# LV
		has_deposit = d_lv_tentacles_blocker
		has_deposit = d_lv_tentacle_symbiosis

		# Base game
		has_deposit = d_dangerous_wildlife_blocker
		has_deposit = d_titanic_life_blocker
		has_deposit = d_hibernating_lithoids
		has_deposit = d_venomous_insects
		has_deposit = d_seed_bombing_fungoid_blocker
		has_deposit = d_seed_bombing_plantoid_blocker
		has_deposit = d_alien_pets_deposit
		has_deposit = d_mutant_landfill
		has_deposit = d_worm_mine
		has_deposit = d_worm_farm
		has_deposit = d_ancient_one
		has_deposit = d_fungal_study_zone
		has_deposit = d_landed_dragon
		has_deposit = d_toxic_god_deitys_swarms
		has_deposit = d_toxic_god_deitys_swarms_upgraded
		has_deposit = d_alien_sanctuary
	}

}

# Makes it easy to add support for other mods that add planet types
# ROOT = planet
lv_is_habitable_world = {

	OR = {
		# LV
		is_planet_class = pc_lv_sworld
		is_planet_class = pc_lv_srelic
		is_planet_class = pc_lv_stentacle

		is_planet_class = pc_lv_sringworld

		# Base game
		colonizable_planet = yes
	}

}

# Is Sexopolis megastructure check (absorbed mod)
# ROOT = planet
lv_is_sexopolis_structure = {

	is_planet_class = pc_lv_sringworld

}

# Tentacle check
# ROOT = planet
lv_tentacle_present = {

	OR = {
		has_modifier = lv_tentacled_lifeforms
		has_modifier = lv_aggressive_tentacled_lifeforms
		has_modifier = lv_coexisting_tentacled_lifeforms
		has_deposit = d_lv_tentacles_blocker
		has_deposit = d_lv_tentacle_symbiosis
		any_owned_pop_group = { pop_group_has_trait = trait_lv_presapient_tentacle_lifeform }
	}

}

#######################
# Planet/Colony Scope #
#######################

# True if this planet's owner owns a sapient biological/lithoid species that is not currently set to purge
# ROOT = planet/colony
lv_planet_owner_has_non_purged_biological_species = {

	exists = owner
	owner = { lv_country_has_non_purged_biologically_functional_species = yes }

}

################
# Colony Scope #
################

# Buildings #

# District potential check
# ROOT = colony
lv_uses_standard_district = {

	OR = {
		uses_district_set = standard
		uses_district_set = hive_world
		uses_district_set = machine_world
	}

}

# Has any gem incubation zone
# ROOT = colony
lv_has_any_gem_incubation_zone = {

	has_zone = { zone = zone_lv_gem_incubation }
}

# Jobs #

# Has dairy job check
# ROOT = colony
has_lv_dairy_job = {

	any_owned_pop_job = {
		OR = {
			has_job_type = lv_dairy_milk_cow
			has_job_type = lv_dairy_milk_drone
		}
	}

}

# Has breeding job check
# ROOT = colony
has_lv_breeding_job = {

	any_owned_pop_job = {
		OR = {
			has_job_type = lv_breeding_breeder
			has_job_type = lv_breeding_breeder_drone
			has_job_type = lv_breeding_gem_incubator
			has_job_type = lv_breeding_gem_incubator_drone
		}
	}

}

# Has sex job check
# ROOT = colony
has_lv_sex_job = {

	any_owned_pop_job = {
		OR = {
			has_job_type = lv_sex_whore
			has_job_type = lv_sex_psi_whore
			has_job_type = lv_sex_sexbot
			has_job_type = lv_sex_concubine
			has_job_type = lv_sex_pleasure_drone
			has_job_type = lv_sex_psi_pleasure_drone
			has_job_type = lv_sex_sexbot_drone
			has_job_type = lv_sex_escort
			has_job_type = lv_sex_erotic_content_creator
			has_job_type = lv_sex_cruise_first_class_promiscuant
			has_job_type = lv_sex_servitor_sex_trophy
			has_job_type = lv_sex_stimulator
			has_job_type = lv_sex_stimulator_drone
			has_job_type = lv_sex_sexologist_physicist
			has_job_type = lv_sex_sexologist_biologist
			has_job_type = lv_sex_sexologist_engineer
			has_job_type = lv_sex_experimenter_drone_physicist
			has_job_type = lv_sex_experimenter_drone_biologist
			has_job_type = lv_sex_experimenter_drone_engineer

			# Still affected by sex traits
			has_job_type = lv_support_comfort_worker
			has_job_type = lv_support_nurture_drone

			# Submod compatibility #

			# Family Oriented
			has_job_type = FO_lv_family_planner
		}
	}

}

# Has meaningful Organic Response Data target employment
# ROOT = colony
lv_has_organic_response_data_target_jobs = {

	OR = {
		num_assigned_jobs = {
			job = lv_sex_pleasure_drone
			value >= 100
		}
		num_assigned_jobs = {
			job = lv_sex_sexbot_drone
			value >= 100
		}
		num_assigned_jobs = {
			job = lv_sex_stimulator_drone
			value >= 100
		}
		num_assigned_jobs = {
			job = lv_sex_experimenter_drone_physicist
			value >= 100
		}
		num_assigned_jobs = {
			job = lv_sex_experimenter_drone_biologist
			value >= 100
		}
		num_assigned_jobs = {
			job = lv_sex_experimenter_drone_engineer
			value >= 100
		}
	}

}

# Gestalt with non gestalt pops
# ROOT = colony
lv_is_gestalt_with_non_gestalt_pops = {

	exists = owner
	owner = { is_gestalt = yes }

	exists = growing_species
	growing_species = {
		NOR = {
			has_trait = trait_hive_mind
			has_trait = trait_machine_unit
			has_trait = trait_mechanical
		}
	}

}

# Pops #

# Equine penis check
# ROOT = colony
lv_has_equine_pop = {

	any_owned_pop_group = { pop_group_has_trait = trait_lv_equine_penis }

}

#################################
# Breeder Trait Presence Checks #
#################################

# These helpers are called from breeder job/Pop Group modifier potentials.
# They test the current breeder Pop Group directly; do not iterate colony Pops here.

# Breeder trait check - Soft
# ROOT = pop_group/job
lv_breeder_trait_check_soft = {

	has_trait = trait_lv_soft

}

# Breeder trait check - Cute
# ROOT = pop_group/job
lv_breeder_trait_check_cute = {

	has_trait = trait_lv_cute

}

# Breeder trait check - Sexually Gifted
# ROOT = pop_group/job
lv_breeder_trait_check_sexually_gifted = {

	has_trait = trait_lv_sexually_gifted

}

# Breeder trait check - Masochistic
# ROOT = pop_group/job
lv_breeder_trait_check_masochistic = {

	has_trait = trait_lv_masochistic

}

# Breeder trait check - Sexual Pheromones
# ROOT = pop_group/job
lv_breeder_trait_check_sexual_pheromones = {

	has_trait = trait_lv_sexual_pheromones

}

# Breeder trait check - Targeted Pheromones
# ROOT = pop_group/job
lv_breeder_trait_check_targeted_pheromones = {

	has_trait = trait_lv_targeted_pheromones

}

# Breeder trait check - Nudist
# ROOT = pop_group/job
lv_breeder_trait_check_nudist = {

	has_trait = trait_lv_nudist

}

# Breeder trait check - Exhibitionist
# ROOT = pop_group/job
lv_breeder_trait_check_exhibitionist = {

	has_trait = trait_lv_exhibitionist

}

# Breeder trait check - Honey
# ROOT = pop_group/job
lv_breeder_trait_check_honey = {

	has_trait = trait_lv_honey

}

# Breeder trait check - Exotic Honey
# ROOT = pop_group/job
lv_breeder_trait_check_exotic_honey = {

	has_trait = trait_lv_exotic_honey

}

# Breeder trait check - Elastic Orifices
# ROOT = pop_group/job
lv_breeder_trait_check_elastic_orifices = {

	has_trait = trait_lv_elastic_orifices

}

# Breeder trait check - Natural Anal Lube
# ROOT = pop_group/job
lv_breeder_trait_check_natural_anal_lube = {

	has_trait = trait_lv_natural_anal_lube

}

# Breeder trait check - Long Tongues
# ROOT = pop_group/job
lv_breeder_trait_check_long_tongues = {

	has_trait = trait_lv_long_tongues

}

# Breeder trait check - Neuron Saliva
# ROOT = pop_group/job
lv_breeder_trait_check_neuron_saliva = {

	has_trait = trait_lv_neuron_saliva

}

# Breeder trait check - Large Breasts
# ROOT = pop_group/job
lv_breeder_trait_check_large_breasts = {

	has_trait = trait_lv_large_breasts

}

# Breeder trait check - Huge Breasts
# ROOT = pop_group/job
lv_breeder_trait_check_huge_breasts = {

	has_trait = trait_lv_huge_breasts

}

# Breeder trait check - Multiple Breasts
# ROOT = pop_group/job
lv_breeder_trait_check_multiple_breasts = {

	has_trait = trait_lv_multiple_breasts

}

# Breeder trait check - Fuckable Nipples
# ROOT = pop_group/job
lv_breeder_trait_check_fuckable_nipples = {

	has_trait = trait_lv_fuckable_nipples

}

# Breeder trait check - High Volume Lactation
# ROOT = pop_group/job
lv_breeder_trait_check_high_volume_lactation = {

	has_trait = trait_lv_high_volume_lactation

}

# Breeder trait check - Fizzy Milk
# ROOT = pop_group/job
lv_breeder_trait_check_fizzy_milk = {

	has_trait = trait_lv_fizzy_milk

}

# Breeder trait check - Aphrodisiac Milk
# ROOT = pop_group/job
lv_breeder_trait_check_aphrodisiac_milk = {

	has_trait = trait_lv_aphrodisiac_milk

}

# Breeder trait check - Drooling Vagina
# ROOT = pop_group/job
lv_breeder_trait_check_drooling_vagina = {

	has_trait = trait_lv_drooling_vagina

}

# Breeder trait check - Litters
# ROOT = pop_group/job
lv_breeder_trait_check_litters = {

	has_trait = trait_lv_litters

}

# Breeder trait check - Shapely Ass
# ROOT = pop_group/job
lv_breeder_trait_check_shapely_ass = {

	has_trait = trait_lv_shapely_ass

}

# Breeder trait check - Breeder Hips
# ROOT = pop_group/job
lv_breeder_trait_check_breeder_hips = {

	has_trait = trait_lv_breeder_hips

}

# Breeder trait check - Large Penis
# ROOT = pop_group/job
lv_breeder_trait_check_large_penis = {

	has_trait = trait_lv_large_penis

}

# Breeder trait check - Huge Penis
# ROOT = pop_group/job
lv_breeder_trait_check_huge_penis = {

	has_trait = trait_lv_huge_penis

}

# Breeder trait check - Multiple Penises
# ROOT = pop_group/job
lv_breeder_trait_check_multiple_penises = {

	has_trait = trait_lv_multiple_penises

}

# Breeder trait check - High Volume Ejaculations
# ROOT = pop_group/job
lv_breeder_trait_check_high_volume_ejaculations = {

	has_trait = trait_lv_high_volume_ejaculations

}

# Breeder trait check - Aphrodisiac Cum
# ROOT = pop_group/job
lv_breeder_trait_check_aphrodisiac_cum = {

	has_trait = trait_lv_aphrodisiac_cum

}

# Breeder trait check - Addictive Cum
# ROOT = pop_group/job
lv_breeder_trait_check_addictive_cum = {

	has_trait = trait_lv_addictive_cum

}

# Breeder trait check - Sadistic
# ROOT = pop_group/job
lv_breeder_trait_check_sadistic = {

	has_trait = trait_lv_sadistic

}

# Breeder trait check - Erogenous Anus
# ROOT = pop_group/job
lv_breeder_trait_check_erogenous_anus = {

	has_trait = trait_lv_erogenous_anus

}

# Breeder trait check - Lewd Mind
# ROOT = pop_group/job
lv_breeder_trait_check_lewd_mind = {

	has_trait = trait_lv_lewd_mind

}

# Breeder trait check - Sex Crazed
# ROOT = pop_group/job
lv_breeder_trait_check_sex_crazed = {

	has_trait = trait_lv_sex_crazed

}

# Breeder trait check - Seasonal Breeders
# ROOT = pop_group/job
lv_breeder_trait_check_seasonal_breeders = {

	has_trait = trait_lv_seasonal_breeders

}

# Breeder trait check - Sexually Inept
# ROOT = pop_group/job
lv_breeder_trait_check_sexually_inept = {

	has_trait = trait_lv_sexually_inept

}

# Breeder trait check - Sexually Repressed
# ROOT = pop_group/job
lv_breeder_trait_check_sexually_repressed = {

	has_trait = trait_lv_sexually_repressed

}

# Breeder trait check - Small Penis
# ROOT = pop_group/job
lv_breeder_trait_check_small_penis = {

	has_trait = trait_lv_small_penis

}

# Breeder trait check - Brood Parasite
# ROOT = pop_group/job
lv_breeder_trait_check_brood_parasite = {

	has_trait = trait_lv_brood_parasite

}

# Breeder trait check - Futanari
# ROOT = pop_group/job
lv_breeder_trait_check_futanari = {

	has_trait = trait_lv_futanari

}

# Breeder trait check - Nano Forge Womb
# ROOT = pop_group/job
lv_breeder_trait_check_nano_forge_womb = {

	has_trait = trait_lv_nano_forge_womb

}

# Breeder trait check - Perfect Hybrid
# ROOT = pop_group/job
lv_breeder_trait_check_perfect_hybrid = {

	has_trait = trait_lv_perfect_hybrid

}

# Breeder trait check - Titanic Evolution
# ROOT = pop_group/job
lv_breeder_trait_check_titanic_evolution = {

	has_trait = trait_lv_titanic_evolution

}

# Breeder trait check - Prize Cow
# ROOT = pop_group/job
lv_breeder_trait_check_prize_cow = {

	has_trait = trait_lv_prize_cow

}

# Breeder trait check - Femboy
# ROOT = pop_group/job
lv_breeder_trait_check_femboy = {

	has_trait = trait_lv_femboy

}

# Breeder trait check - Pheromone Generators
# ROOT = pop_group/job
lv_breeder_trait_check_pheromone_generators = {

	has_trait = trait_lv_pheromone_generators

}

# Breeder trait check - Breast Attachments
# ROOT = pop_group/job
lv_breeder_trait_check_breast_attachments = {

	has_trait = trait_lv_breast_attachments

}

# Breeder trait check - Custom Fleshlight Slot
# ROOT = pop_group/job
lv_breeder_trait_check_custom_fleshlight_slot = {

	has_trait = trait_lv_custom_fleshlight_slot

}

# Breeder trait check - Synth Breasts
# ROOT = pop_group/job
lv_breeder_trait_check_synth_breasts = {

	has_trait = trait_lv_synth_breasts

}

# Breeder trait check - Synth Vagina
# ROOT = pop_group/job
lv_breeder_trait_check_synth_vagina = {

	has_trait = trait_lv_synth_vagina

}

# Breeder trait check - Lushtech Synthetic Womb
# ROOT = pop_group/job
lv_breeder_trait_check_lushtech_synthetic_womb = {

	has_trait = trait_lv_lushtech_synthetic_womb

}

# Breeder trait check - Sex Bots
# ROOT = pop_group/job
lv_breeder_trait_check_sex_bots = {

	has_trait = trait_lv_sex_bots

}

# Breeder trait check - Sex Bots O
# ROOT = pop_group/job
lv_breeder_trait_check_sex_bots_o = {

	has_trait = trait_lv_sex_bots_o

}

# Breeder trait check - Custom Dildo Attachment
# ROOT = pop_group/job
lv_breeder_trait_check_custom_dildo_attachment = {

	has_trait = trait_lv_custom_dildo_attachment

}

# Breeder trait check - Synth Penis
# ROOT = pop_group/job
lv_breeder_trait_check_synth_penis = {

	has_trait = trait_lv_synth_penis

}

# Breeder trait check - Lushtech Omni Seed Fabrication Modules
# ROOT = pop_group/job
lv_breeder_trait_check_lushtech_omni_seed_fabrication_modules = {

	has_trait = trait_lv_lushtech_omni_seed_fabrication_modules

}

##############
# Ship Scope #
##############

# Checks if ship can be boarded
# ROOT = ship
lv_is_not_a_bad_dwagon = {

	NOR = {
		is_ship_size = security_system_drone
		is_ship_size = asteroid
		is_ship_size = probe
		is_ship_size = large_ship_swarm
		is_ship_size = large_ship_carrier_swarm
		is_ship_size = small_ship_swarm
		is_ship_size = queen_swarm
		is_ship_size = construction_ship_swarm
		is_ship_size = colony_ship_swarm
		is_ship_size = transport_ship_swarm
		is_ship_size = large_ship_ed
		is_ship_size = medium_ship_ed
		is_ship_size = small_ship_ed
		is_ship_size = dimensional_portal_ed
		is_ship_size = construction_ship_ed
		is_ship_size = crystal_ship_small_blue
		is_ship_size = crystal_ship_medium_blue
		is_ship_size = crystal_ship_large_blue
		is_ship_size = crystal_ship_small_green
		is_ship_size = crystal_ship_medium_green
		is_ship_size = crystal_ship_large_green
		is_ship_size = crystal_ship_small_yellow
		is_ship_size = crystal_ship_medium_yellow
		is_ship_size = crystal_ship_large_yellow
		is_ship_size = crystal_ship_small_red
		is_ship_size = crystal_ship_medium_red
		is_ship_size = crystal_ship_large_red
		is_ship_size = crystal_ship_small_blue_elite
		is_ship_size = crystal_ship_medium_blue_elite
		is_ship_size = crystal_ship_large_blue_elite
		is_ship_size = crystal_ship_small_green_elite
		is_ship_size = crystal_ship_medium_green_elite
		is_ship_size = crystal_ship_large_green_elite
		is_ship_size = crystal_ship_small_yellow_elite
		is_ship_size = crystal_ship_medium_yellow_elite
		is_ship_size = crystal_ship_large_yellow_elite
		is_ship_size = crystal_ship_small_red_elite
		is_ship_size = crystal_ship_medium_red_elite
		is_ship_size = crystal_ship_large_red_elite
		is_ship_size = crystal_station_large
		is_ship_size = space_cloud
		is_ship_size = space_amoeba
		is_ship_size = space_amoeba_mother
		is_ship_size = space_whale_1
		is_ship_size = space_whale_2
		is_ship_size = space_whale_3
		is_ship_size = space_whale_4
		is_ship_size = space_whale_5
		is_ship_size = lost_swarm_adult
		is_ship_size = ancient_mining_drone
		is_ship_size = ancient_corvette
		is_ship_size = ancient_destroyer
		is_ship_size = lesser_space_cloud
		is_ship_size = large_ship_ai
		is_ship_size = small_ship_ai
		is_ship_size = military_station_large_ai
		is_ship_size = military_station_small_ai
		is_ship_size = core_ai
		is_ship_size = final_core_ai
		is_ship_size = construction_ship_ai
		is_ship_size = colony_ship_ai
		is_ship_size = transport_ship_ai
		is_ship_size = blue_core_ai
		is_ship_size = blue_military_station_large_ai
		is_ship_size = blue_military_station_small_ai
		is_ship_size = blue_transport_ship_ai
		is_ship_size = space_dragon_red
		is_ship_size = stellarite
		is_ship_size = sphere
		is_ship_size = dimensional_horror
		is_ship_size = npc_warship_01
		is_ship_size = wraith_01_blue
		is_ship_size = wraith_01_red
		is_ship_size = wraith_01_yellow
		is_ship_size = space_dragon_baby
		is_ship_size = space_dragon_blue
		is_ship_size = space_dragon_origin
		is_ship_size = space_dragon_origin_baby
		is_ship_size = psionic_avatar
		is_ship_size = corrupted_avatar
		is_ship_size = shroud_manifestation
		is_ship_size = warped_consciousness
		is_ship_size = leviathan_01_scavenger_bot
		is_ship_size = leviathan_01_elder_tiyanki
		is_ship_size = leviathan_01_voidspawn
		is_ship_size = enigmatic_cache
		is_ship_size = nanite_space_dragon_baby
		is_ship_size = space_amoeba_centenarian
		is_ship_size = graygoo_mothership
		is_ship_size = graygoo_interdictor
		is_ship_size = graygoo_factory
		is_ship_size = wenkwort_drone
		is_ship_size = training_target
		is_ship_size = ancient_mining_expansion_barge
		is_ship_size = ancient_mining_expansion_drone
		is_ship_size = crystal_splitter_ship_large_blue
		is_ship_size = reanimated_space_dragon_red
		is_ship_size = reanimated_space_dragon_blue
		is_ship_size = reanimated_space_dragon_origin
		is_ship_size = reanimated_leviathan_01_elder_tiyanki
		is_ship_size = reanimated_leviathan_01_voidspawn
		is_ship_size = reanimated_space_amoeba
		is_ship_size = reanimated_space_amoeba_centenarian
		is_ship_size = reanimated_space_amoeba_mother
		is_ship_size = reanimated_space_whale_1
		is_ship_size = reanimated_space_whale_2
		is_ship_size = reanimated_space_whale_3
		is_ship_size = reanimated_space_whale_4
		is_ship_size = gravity_snare
		is_ship_size = voidworms_small
		is_ship_size = voidworms_medium
		is_ship_size = voidworms_large
		is_ship_size = voidworms_titan
		is_ship_size = voidworm_nest
		is_ship_size = cutholoids_hatchling
		is_ship_size = cutholoids_juvenile
		is_ship_size = cutholoids
		is_ship_size = reanimated_voidworms_small
		is_ship_size = reanimated_voidworms_medium
		is_ship_size = reanimated_voidworms_large
		is_ship_size = reanimated_voidworms_titan
		is_ship_size = reanimated_cutholoids_hatchling
		is_ship_size = reanimated_cutholoids_juvenile
		is_ship_size = reanimated_cutholoids
	}

}

#################
# Species Scope #
#################

# Checks whether a Species includes a viable inseminating phenotype
# Mixed-sex species qualify through their males; all-male and futanari species qualify explicitly
# ROOT = species
lv_species_can_supply_invasive_seed = {

	OR = {
		# Natural biological or lithoid insemination
		AND = {
			# ROOT is already Species; use the direct Species-safe trigger.
			is_robotic = no
			OR = {
				has_trait = trait_lv_all_male
				has_trait = trait_lv_futanari
				AND = {
					NOR = {
						has_trait = trait_lv_all_female
						has_trait = trait_lv_androgynous
					}
					OR = {
						species_gender = male
						species_gender = not_set
					}
				}
			}
		}

		# Specialized biological, cybernetic or synthetic seed systems
		# A synthetic penis alone is sexual hardware, not a fertile seed source.
		has_trait = trait_lv_intercompatible_sperm
		has_trait = trait_lv_lushtech_omni_seed_fabrication_modules_cyborg
		has_trait = trait_lv_lushtech_omni_seed_fabrication_modules
	}

}

# Checks whether a Species can carry the seductive invasive bloodline
# ROOT = species
lv_species_can_carry_seductive_brood = {

	lv_can_become_pregnant = yes
	NOR = {
		has_trait = trait_lv_all_male
		has_trait = trait_lv_futanari
		has_trait = trait_lv_androgynous
	}
	OR = {
		has_trait = trait_lv_all_female
		species_gender = female
	}

}

# Checks if this Species can carry a pregnancy or artificial gestation
# ROOT = species
lv_can_become_pregnant = {

	OR = {
		# Natural biological or lithoid gestation
		AND = {
			# ROOT is already Species; use the direct Species-safe trigger.
			is_robotic = no
			NOT = { species_gender = male }
			NOT = { has_trait = trait_lv_all_male }
		}

		# Specialized biological gestation
		has_trait = trait_lv_intercompatible_womb
		has_trait = trait_lv_nano_forge_womb

		# Cybernetic artificial gestation
		has_trait = trait_lv_lushtech_synthetic_womb_cyborg
		has_trait = trait_lv_sex_dolls_cyborg

		# Fully synthetic artificial gestation
		has_trait = trait_lv_lushtech_synthetic_womb
		has_trait = trait_lv_sex_bots
		has_trait = trait_lv_sex_bots_o
	}

}

# Checks whether this Pop Group can act as the penis-bearing aggressive invasive parent
# ROOT = pop_group
lv_is_valid_aggressive_invasive_parent = {

	pop_group_size > 0
	is_sapient = yes
	has_trait = trait_lv_aggressively_adaptive_reproduction
	species = { lv_species_can_supply_invasive_seed = yes }
	is_being_purged = no
	is_being_assimilated = no

}

# Checks whether this Pop Group can act as the womb-bearing seductive invasive parent
# ROOT = pop_group
lv_is_valid_seductive_invasive_parent = {

	pop_group_size > 0
	is_sapient = yes
	has_trait = trait_lv_seductively_adaptive_reproduction
	species = { lv_species_can_carry_seductive_brood = yes }
	is_being_purged = no
	is_being_assimilated = no

}

# Umbrella invasive-parent check used by shared policy and scheduling code
# ROOT = pop_group
lv_is_valid_invasive_parent = {

	OR = {
		lv_is_valid_aggressive_invasive_parent = yes
		lv_is_valid_seductive_invasive_parent = yes
	}

}


# Checks whether this Pop Group can carry offspring for an aggressive invasive parent
# ROOT = pop_group
lv_is_valid_invasive_breeding_host = {

	pop_group_size > 0
	is_sapient = yes
	species = { lv_can_become_pregnant = yes }
	is_being_purged = no
	is_being_assimilated = no
	NOR = {
		has_trait = trait_lv_aggressively_adaptive_reproduction
		has_trait = trait_lv_seductively_adaptive_reproduction
	}

}

# Checks whether this Pop Group can inseminate a seductive invasive parent
# ROOT = pop_group
lv_is_valid_invasive_seed_donor = {

	pop_group_size > 0
	is_sapient = yes
	species = { lv_species_can_supply_invasive_seed = yes }
	is_being_purged = no
	is_being_assimilated = no
	NOR = {
		has_trait = trait_lv_aggressively_adaptive_reproduction
		has_trait = trait_lv_seductively_adaptive_reproduction
	}

}


# Checks if a robutt has sexually attractive or sexualized characteristics
# ROOT = species/pop_group/job
lv_is_a_smexy_robutt = {

	OR = {
		has_trait = trait_lv_pheromone_generators
		has_trait = trait_lv_breast_attachments
		has_trait = trait_lv_synth_breasts
		has_trait = trait_lv_custom_fleshlight_slot
		has_trait = trait_lv_synth_vagina
		has_trait = trait_lv_sex_bots
		has_trait = trait_lv_sex_bots_o
		has_trait = trait_lv_custom_dildo_attachment
		has_trait = trait_lv_lushtech_omni_seed_fabrication_modules
	}

}

# The vanilla is_livestock scripted trigger checks slavery_livestock against
# ROOT, so this helper must be called from a Country-rooted Pop Group iterator
# Counts as currently usable Smexy Robutt workforce
# ROOT = owning country
# THIS = owned pop_group
lv_counts_as_smexy_robutt_workforce = {

	exists = owner
	owner = { is_machine_empire = yes }

	lv_is_a_smexy_robutt = yes

	is_being_purged = no
	is_being_assimilated = no
	is_livestock = no

	NOR = {
		has_citizenship_type = {
			type = citizenship_organic_trophy
			country = owner
		}
		has_citizenship_type = {
			type = citizenship_cruise_passenger
			country = owner
		}
	}

}

###########################
# Pop Group/Job Scope     #
###########################

# Overlord requisitorium energy
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_energy = {

	colony = { has_carrier_flag = has_energy_requisitorium }

}

# Overlord requisitorium food reduction organic
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_food_reduction_organic = {

	colony = { has_carrier_flag = has_produce_requisitorium }

	exists = owner
	owner = { is_lithoid_or_infernal_empire = no }

}

# Overlord requisitorium minerals reduction lithoid
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_minerals_reduction_lithoid = {

	colony = { has_carrier_flag = has_produce_requisitorium }

	exists = owner
	owner = { is_lithoid_empire = yes }

}

# Overlord requisitorium alloys reduction infernal
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_alloys_reduction_infernal = {

	colony = { has_carrier_flag = has_produce_requisitorium }

	exists = owner
	owner = { is_infernal_empire = yes }

}

# Overlord requisitorium food organic
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_food_overlord_organic = {

	colony = {
		has_carrier_flag = has_produce_requisitorium

		exists = owner
		owner = { is_lithoid_or_infernal_empire = no }
	}

}

# Overlord requisitorium minerals lithoid
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_minerals_overlord_lithoid = {

	colony = {
		has_carrier_flag = has_produce_requisitorium

		exists = owner
		owner = { is_lithoid_empire = yes }
	}

}

# Overlord requisitorium alloys infernal
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_alloys_overlord_infernal = {

	colony = {
		has_carrier_flag = has_produce_requisitorium

		exists = owner
		owner = { is_infernal_empire = yes }
	}

}

# Overlord requisitorium overlord resources balanced (default)
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_reduction_gem_incubator_balanced = {

	colony = {
		has_carrier_flag = has_material_requisitorium
		has_carrier_flag = lv_gem_incubator_processing_balanced
	}

}

# Overlord requisitorium overlord resources alloys
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_reduction_gem_incubator_alloys = {

	colony = {
		has_carrier_flag = has_material_requisitorium
		has_carrier_flag = lv_gem_incubator_processing_alloys
	}

}

# Overlord requisitorium overlord resources minerals
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_reduction_gem_incubator_minerals = {

	colony = {
		has_carrier_flag = has_material_requisitorium
		has_carrier_flag = lv_gem_incubator_processing_minerals
	}

}

# Overlord requisitorium research
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_research = {

	colony = { has_carrier_flag = has_science_ministry }

}

# Overlord requisitorium research physicist is astrometeorologist
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_research_physicist_is_astrometeorologist = {

	colony = {
		has_carrier_flag = has_science_ministry
		physicist_is_astrometeorologist_trigger = yes
		solar_system? = {
			OR = {
				has_environmental_effects = yes
				has_star_flag = storm_system
			}
		}
	}

}

# Overlord requisitorium consumer goods, sexology focus balanced
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_consumer_goods_sexology_focus_balanced = {

	colony = {
		has_carrier_flag = has_produce_requisitorium
		has_carrier_flag = lv_sexology_focus_balanced
	}
	exists = owner.overlord
	owner.overlord = { country_uses_consumer_goods = yes }

}

# Overlord requisitorium consumer goods, sexology focus consumer goods
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_consumer_goods_sexology_focus_consumer_goods = {

	colony = {
		has_carrier_flag = has_produce_requisitorium
		has_carrier_flag = lv_sexology_focus_consumer_goods
	}
	exists = owner.overlord
	owner.overlord = { country_uses_consumer_goods = yes }

}

# Overlord requisitorium consumer goods, sexology focus balanced resources
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_consumer_goods_overlord_sexology_focus_balanced = {

	colony = {
		has_carrier_flag = has_produce_requisitorium
		exists = owner.overlord
		owner.overlord = { country_uses_consumer_goods = yes }
		has_carrier_flag = lv_sexology_focus_balanced
	}

}

# Overlord requisitorium consumer goods, sexology focus consumer goods resources
# ROOT = pop_group/job (requires colony link)
lv_has_produce_requisitorium_consumer_goods_overlord_sexology_focus_consumer_goods = {

	colony = {
		has_carrier_flag = has_produce_requisitorium
		exists = owner.overlord
		owner.overlord = { country_uses_consumer_goods = yes }
		has_carrier_flag = lv_sexology_focus_consumer_goods
	}

}

# Faith in Science Amenities
# ROOT = pop_group/job
lv_has_faith_in_science = {

	owner? = { has_active_tradition = tr_discovery_faith_in_science }

}

# Caregiver Paragon Effect
# ROOT = pop_group/job
lv_has_nomadic_caregiver = {

	leader? = { has_trait = leader_trait_nomadic_caregiver }
	owner? = { NOT = { has_valid_civic = civic_dystopian_society } }

}

# Dimensional Portal Amenities Normal
# ROOT = pop_group/job (requires colony link)
lv_has_dimensional_portal_amenities_normal = {

	colony? = { has_modifier = dportal_trade_normal }
	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

}

# Dimensional Portal Amenities High
# ROOT = pop_group/job (requires colony link)
lv_has_dimensional_portal_amenities_high = {

	colony? = { has_modifier = dportal_trade_high }
	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

}

# Dimensional Portal Amenities Low
# ROOT = pop_group/job (requires colony link)
lv_has_dimensional_portal_amenities_low = {

	colony? = { has_modifier = dportal_trade_low }
	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

}

# Dimensional Portal Amenities Crisis
# ROOT = pop_group/job (requires colony link)
lv_has_dimensional_portal_amenities_crisis = {

	colony? = { has_modifier = dportal_trade_crisis }
	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

}

# Ranger Amenities
# ROOT = pop_group/job (requires colony link)
lv_biologist_ranger_amenities = {

	colony? = { biologist_is_ranger_trigger = yes }
	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

}

# Has alpha hub
# ROOT = pop_group/job (requires colony link)
lv_has_alpha_hub = {

	colony = {
		is_ringworld = yes
		has_building = building_alpha_hub
	}

}

# Has nurture hub orbital ring module
# ROOT = pop_group/job (requires colony link)
lv_has_ring_nurture_hub = {

	colony.orbital_defence.starbase? = { has_starbase_building = lv_ring_nurture_hub }

}

# Has brothel hub orbital ring module
# ROOT = pop_group/job (requires colony link)
lv_has_ring_brothel_hub = {

	colony.orbital_defence.starbase? = { has_starbase_building = lv_ring_brothel_hub }

}

# Is Machine Empire
# ROOT = pop_group/job
lv_is_machine_empire = {

	exists = owner
	owner = { is_machine_empire = yes }

}

# Is Wilderness Empire
# ROOT = pop_group/job
lv_is_wilderness_empire = {

	exists = owner
	owner = { is_wilderness_empire = yes }

}

# Archeo Drone
# ROOT = pop_group/job (requires colony link)
lv_gestalt_archaeostudies = {

	colony? = { biologist_is_archaeo_engineer_trigger = yes }
	exists = owner
	owner = { is_gestalt = yes }

}

# Gem Incubator balanced flag check (default)
# ROOT = pop_group/job (requires colony link)
lv_gem_incubator_balanced_flag = {

	colony = { has_carrier_flag = lv_gem_incubator_processing_balanced }

}

# Gem Incubator alloys flag check
# ROOT = pop_group/job (requires colony link)
lv_gem_incubator_alloys_flag = {

	colony = { has_carrier_flag = lv_gem_incubator_processing_alloys }

}

# Gem Incubator minerals flag check
# ROOT = pop_group/job (requires colony link)
lv_gem_incubator_minerals_flag = {

	colony = { has_carrier_flag = lv_gem_incubator_processing_minerals }

}

# Gem Incubator overlord requisitorium balanced flag check (default)
# ROOT = pop_group/job (requires colony link)
lv_gem_incubator_requisitorium_balanced_flag = {

	colony = {
		has_carrier_flag = has_material_requisitorium
		has_carrier_flag = lv_gem_incubator_processing_balanced
	}

}

# Gem Incubator overlord requisitorium alloys flag check
# ROOT = pop_group/job (requires colony link)
lv_gem_incubator_requisitorium_alloys_flag = {

	colony = {
		has_carrier_flag = has_material_requisitorium
		has_carrier_flag = lv_gem_incubator_processing_alloys
	}

}

# Gem Incubator overlord requisitorium minerals flag check
# ROOT = pop_group/job (requires colony link)
lv_gem_incubator_requisitorium_minerals_flag = {

	colony = {
		has_carrier_flag = has_material_requisitorium
		has_carrier_flag = lv_gem_incubator_processing_minerals
	}

}

# Has energy requisitorium
# ROOT = pop_group/job (requires colony link)
lv_has_energy_requisitorium = {

	colony = { has_carrier_flag = has_energy_requisitorium }

}

# Has exploitation accord
# ROOT = pop_group/job
lv_has_exploitation_accord = {

	exists = owner
	owner = { has_modifier = exploitation_accord }

}

# Sexology focus balanced flag check (default)
# ROOT = pop_group/job (requires colony link)
lv_sexology_focus_balanced_flag = {

	colony = { has_carrier_flag = lv_sexology_focus_balanced }

}

# Sexology focus research flag check
# ROOT = pop_group/job (requires colony link)
lv_sexology_focus_research_flag = {

	colony = { has_carrier_flag = lv_sexology_focus_research }

}

# Sexology focus consumer goods flag check
# ROOT = pop_group/job (requires colony link)
lv_sexology_focus_consumer_goods_flag = {

	colony = { has_carrier_flag = lv_sexology_focus_consumer_goods }

}

# Astrometeorologists sexology focus balanced flag check (default)
# ROOT = pop_group/job (requires colony link)
lv_astrometeorologist_sexology_focus_balanced_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_balanced
		physicist_is_astrometeorologist_trigger = yes
		solar_system? = {
			OR = {
				has_environmental_effects = yes
				has_star_flag = storm_system
			}
		}
	}

}

# Astrometeorologists sexology focus research flag check
# ROOT = pop_group/job (requires colony link)
lv_astrometeorologist_sexology_focus_research_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_research
		physicist_is_astrometeorologist_trigger = yes
		solar_system? = {
			OR = {
				has_environmental_effects = yes
				has_star_flag = storm_system
			}
		}
	}

}

# Astrometeorologists sexology focus consumer goods flag check
# ROOT = pop_group/job (requires colony link)
lv_astrometeorologist_sexology_focus_consumer_goods_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_consumer_goods
		physicist_is_astrometeorologist_trigger = yes
		solar_system? = {
			OR = {
				has_environmental_effects = yes
				has_star_flag = storm_system
			}
		}
	}

}

# Extra-dimensional Research sexology focus balanced flag check (default)
# ROOT = pop_group/job (requires colony link)
lv_extradimensional_research_sexology_focus_balanced_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_balanced
		physicist_is_extradimensional_research_unit_trigger = yes
	}

}

# Extra-dimensional Research sexology focus research flag check
# ROOT = pop_group/job (requires colony link)
lv_extradimensional_research_sexology_focus_research_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_research
		physicist_is_extradimensional_research_unit_trigger = yes
	}

}

# Extra-dimensional Research sexology focus consumer goods flag check
# ROOT = pop_group/job (requires colony link)
lv_extradimensional_research_sexology_focus_consumer_goods_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_consumer_goods
		physicist_is_extradimensional_research_unit_trigger = yes
	}

}

# Non-hive non-extra-dimensional research
# ROOT = pop_group/job (requires colony link)
lv_non_hive_non_extradimensional_research = {

	exists = owner
	owner = { is_hive_empire = no }
	colony? = { physicist_is_extradimensional_research_unit_trigger = no }

}

# Non hive is not observator
# ROOT = pop_group/job (requires colony link)
lv_non_hive_is_not_observator = {

	exists = owner
	owner = { is_hive_empire = no }
	colony? = { biologist_is_observator_trigger = no }

}

# Non hive has science ministry
# ROOT = pop_group/job (requires colony link)
lv_non_hive_has_science_ministry = {

	owner? = { is_hive_empire = no }
	colony = { has_carrier_flag = has_science_ministry }

}

# Hive has science ministry
# ROOT = pop_group/job (requires colony link)
lv_hive_has_science_ministry = {

	owner? = { is_hive_empire = yes }
	colony = { has_carrier_flag = has_science_ministry }

}

# Hive is space time researcher
# ROOT = pop_group/job
lv_hive_is_space_time_researcher = {

	physicist_is_space_time_researcher_trigger = yes
	exists = owner
	owner = { is_hive_empire = yes }

}

# Non hive is space time researcher
# ROOT = pop_group/job
lv_non_hive_is_space_time_researcher = {

	physicist_is_space_time_researcher_trigger = yes
	exists = owner
	owner = { is_hive_empire = no }

}

# Is Observator sexology focus balanced flag check (default)
# ROOT = pop_group/job (requires colony link)
lv_is_observator_sexology_focus_balanced_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_balanced
		biologist_is_observator_trigger = yes
	}

}

# Is Observator sexology focus research flag check
# ROOT = pop_group/job (requires colony link)
lv_is_observator_sexology_focus_research_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_research
		biologist_is_observator_trigger = yes
	}

}

# Is Observator sexology focus consumer goods flag check
# ROOT = pop_group/job (requires colony link)
lv_is_observator_sexology_focus_consumer_goods_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_consumer_goods
		biologist_is_observator_trigger = yes
	}

}

# Is Zookeeper sexology focus balanced flag check (default)
# ROOT = pop_group/job (requires colony link)
lv_is_zookeeper_sexology_focus_balanced_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_balanced
		biologist_is_zookeeper_trigger = yes
	}

}

# Is Zookeeper sexology focus research flag check
# ROOT = pop_group/job (requires colony link)
lv_is_zookeeper_sexology_focus_research_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_research
		biologist_is_zookeeper_trigger = yes
	}

}

# Is Zookeeper sexology focus consumer goods flag check
# ROOT = pop_group/job (requires colony link)
lv_is_zookeeper_sexology_focus_consumer_goods_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_consumer_goods
		biologist_is_zookeeper_trigger = yes
	}

}

# Is Nanotech Researcher sexology focus balanced flag check (default)
# ROOT = pop_group/job (requires colony link)
lv_is_nanotech_researcher_sexology_focus_balanced_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_balanced
		engineer_is_nanotech_researcher_trigger = yes
	}

}

# Is Nanotech Researcher sexology focus research flag check
# ROOT = pop_group/job (requires colony link)
lv_is_nanotech_researcher_sexology_focus_research_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_research
		engineer_is_nanotech_researcher_trigger = yes
	}

}

# Is Nanotech Researcher sexology focus consumer goods flag check
# ROOT = pop_group/job (requires colony link)
lv_is_nanotech_researcher_sexology_focus_consumer_goods_flag = {

	colony = {
		has_carrier_flag = lv_sexology_focus_consumer_goods
		engineer_is_nanotech_researcher_trigger = yes
	}

}

# Is robutt
# ROOT = pop_group/job
lv_is_robutt = {

	exists = owner
	owner = { is_machine_empire = yes }

}

# Is robutt and subterranean trader
# ROOT = pop_group/job
lv_is_robutt_and_trader_is_subterranean = {

	exists = owner
	owner = { is_machine_empire = yes }
	trader_is_subterranean = yes

}

# Is hive
# ROOT = pop_group/job
lv_is_hive = {

	exists = owner
	owner = { is_hive_empire = yes }

}

# Is hive and subterranean trader
# ROOT = pop_group/job
lv_is_hive_and_trader_is_subterranean = {

	exists = owner
	owner = { is_hive_empire = yes }
	trader_is_subterranean = yes

}

# Possible check for specialist jobs
# ROOT = pop_group/job
lv_possible_check_specialist = {

	hidden_trigger = { exists = owner }
	owner = {
		is_gestalt = no
	}

}

# Policies #

# Dairy Specialization
# No Specialization active
# ROOT = pop_group/job
lv_milk_cows_policy_default_active = {

	exists = owner
	owner = { has_policy_flag = lv_milk_cows_policy_default }

}

# Maximize Production active organic
# ROOT = pop_group/job
lv_policy_max_milk_active_organic = {

	exists = owner
	owner = {
		is_lithoid_or_infernal_empire = no
		has_policy_flag = lv_milk_cows_policy_max_milk
	}

}

# Maximize Production active lithoids
# ROOT = pop_group/job
lv_policy_max_milk_active_lithoid = {

	exists = owner
	owner = {
		is_lithoid_empire = yes
		has_policy_flag = lv_milk_cows_policy_max_milk
	}

}

# Maximize Production active infernals
# ROOT = pop_group/job
lv_policy_max_milk_active_infernal = {

	exists = owner
	owner = {
		is_infernal_empire = yes
		has_policy_flag = lv_milk_cows_policy_max_milk
	}

}

# Free Use active
# ROOT = pop_group/job
lv_milk_cows_policy_free_use_active = {

	exists = owner
	owner = { has_policy_flag = lv_milk_cows_policy_free_use }

}

# Renting active
# ROOT = pop_group/job
lv_milk_cows_policy_paid_use_active = {

	exists = owner
	owner = { has_policy_flag = lv_milk_cows_policy_paid_use }

}

# Breeding active any
# ROOT = pop_group/job
lv_milk_cows_policy_breeders_active = {

	exists = owner
	owner = { has_policy_flag = lv_milk_cows_policy_breeders }

}

# Breeding active organic
# ROOT = pop_group/job
lv_milk_cows_policy_breeders_active_organic = {

	exists = owner
	owner = {
		is_lithoid_or_infernal_empire = no
		has_policy_flag = lv_milk_cows_policy_breeders
	}

}

# Breeding active lithoids
# ROOT = pop_group/job
lv_milk_cows_policy_breeders_active_lithoid = {

	exists = owner
	owner = {
		is_lithoid_empire = yes
		has_policy_flag = lv_milk_cows_policy_breeders
	}

}

# Breeding active infernal
# ROOT = pop_group/job
lv_milk_cows_policy_breeders_active_infernal = {

	exists = owner
	owner = {
		is_infernal_empire = yes
		has_policy_flag = lv_milk_cows_policy_breeders
	}

}

# Breeding active is hive
# ROOT = pop_group/job
lv_milk_cows_policy_breeders_active_is_hive = {

	exists = owner
	owner = {
		is_hive_empire = yes
		has_policy_flag = lv_milk_cows_policy_breeders
	}

}

# Prostitution
# Prostitution Supported active
# ROOT = pop_group/job
lv_prostitution_policy_prostitution_supported_active = {

	exists = owner
	owner = { has_policy_flag = lv_prostitution_supported }

}

# Civic #

# Has Sexculture civic
# ROOT = pop_group/job
lv_has_sexculture_civic = {

	exists = owner
	owner = { has_valid_civic = civic_lv_sexculture }

}

# Has Franchised Prostitution civic
# ROOT = pop_group/job
lv_has_franchised_prostitution = {

	exists = owner
	owner = { has_valid_civic = civic_lv_franchised_prostitution }

}

# Tradition #

# Synchronicity
# Integrated preservation
# ROOT = pop_group/job
lv_synchronicity_integrated_preservation = {

	exists = owner
	owner = { has_tradition = tr_synchronicity_integrated_preservation }

}

# Advanced server maintenance
# ROOT = pop_group/job
lv_synchronicity_advanced_server_maintenance = {

	exists = owner
	owner = { has_tradition = tr_virtuality_5 }

}

# Milking
# Nourishing Milk active
# ROOT = pop_group/job
lv_milking_2_nourishing_milk_active = {

	exists = owner
	owner = { has_tradition = tr_lv_milking_2_nourishing_milk }

}

# Rich in Calcium active
# ROOT = pop_group/job
lv_milking_4_rich_calcium_active = {

	exists = owner
	owner = { has_tradition = tr_lv_milking_4_rich_calcium }

}

# Nurturing
# Nurturing finished
# ROOT = pop_group/job
lv_nurturing_finished = {

	exists = owner
	owner = { has_active_tradition = tr_lv_nurturing_finish }

}

# Enslaved sadist check
# ROOT = pop_group/job
lv_enslaved_sadist = {

	has_trait = trait_lv_sadistic
	is_enslaved = yes

}

# Jobs #

# Can fill LV drone job
# ROOT = pop_group/job
lv_can_fill_drone_job_trigger = {
	custom_tooltip = LV_DRONE_JOB_TRIGGER

	hidden_trigger = {
		exists = owner

		is_being_purged = no
		is_being_assimilated = no

		# Enslaved pops are intentionally allowed to fill LV drone jobs

		# Temporarily disabled, will make special jobs for them eventually
		NOR = {
			has_citizenship_type = {
				type = citizenship_organic_trophy
				country = owner
			}
			has_citizenship_type = {
				type = citizenship_cruise_passenger
				country = owner
			}
		}

		OR = {
			lv_is_hive = yes
			OR = {
				lv_is_robutt = yes
				lv_is_a_smexy_robutt = yes
			}
		}
	}
}

# Can fill Psionic drone job
# ROOT = pop_group/job
lv_can_fill_psi_drone_job_trigger = {
	custom_tooltip = LV_PSI_DRONE_JOB_TRIGGER

	hidden_trigger = {
		exists = owner
		owner = { is_hive_empire = yes }

		is_being_purged = no
		is_being_assimilated = no

		# Enslaved pops are intentionally allowed to fill LV drone jobs

		# Temporarily disabled, will make special jobs for them eventually
		NOR = {
			has_citizenship_type = {
				type = citizenship_organic_trophy
				country = owner
			}
			has_citizenship_type = {
				type = citizenship_cruise_passenger
				country = owner
			}
		}

		OR = {
			has_trait = trait_latent_psionic
			has_trait = trait_psionic
		}
	}
}

# Can fill Sexbot drone job
# ROOT = pop_group/job
lv_can_fill_sexbot_drone_job_trigger = {
	custom_tooltip = LV_SEXBOT_DRONE_JOB_TRIGGER

	hidden_trigger = {
		exists = owner
		owner = { is_machine_empire = yes }

		is_being_purged = no
		is_being_assimilated = no

		# Enslaved pops are intentionally allowed to fill LV drone jobs

		# Temporarily disabled, will make special jobs for them eventually
		NOR = {
			has_citizenship_type = {
				type = citizenship_organic_trophy
				country = owner
			}
			has_citizenship_type = {
				type = citizenship_cruise_passenger
				country = owner
			}
		}

		OR = {
			lv_is_a_cyborg = yes
			lv_is_a_smexy_robutt = yes
		}
	}
}

# Can fill Breeding specialist job
# ROOT = pop_group/job
lv_can_fill_breeding_specialist_job_trigger = {
	custom_tooltip = SPECIALIST_JOB_TRIGGER

	hidden_trigger = {

		exists = owner
		is_being_purged = no
		is_being_assimilated = no

		OR = {
			NOT = { has_trait = trait_mechanical }
			AND = {
				owner = { has_technology = tech_droid_workers }
				lv_is_a_smexy_robutt = yes
			}
		}

		# Organic Trophies and Cruise Passengers use dedicated special-job lanes.
		NOR = {
			has_citizenship_type = {
				type = citizenship_organic_trophy
				country = owner
			}
			has_citizenship_type = {
				type = citizenship_cruise_passenger
				country = owner
			}
		}

		if = {
			limit = {
				divinity_right_to_work_job_check_trigger_exempt = no
			}
			divinity_right_to_work_job_check_trigger_specialist = yes
		}

	}
}

# Can fill Sex specialist job
# ROOT = pop_group/job
lv_can_fill_sex_specialist_job_trigger = {
	custom_tooltip = SPECIALIST_JOB_TRIGGER

	hidden_trigger = {

		exists = owner

		OR = {
			is_enslaved = no
			has_slavery_type = { type = slavery_domestic }
		}

		is_being_purged = no
		is_being_assimilated = no

		OR = {
			NOT = { has_trait = trait_mechanical }
			AND = {
				owner = { has_technology = tech_droid_workers }
				lv_is_a_smexy_robutt = yes
			}
		}

		# Organic Trophies and Cruise Passengers use dedicated special-job lanes.
		NOR = {
			has_citizenship_type = {
				type = citizenship_organic_trophy
				country = owner
			}
			has_citizenship_type = {
				type = citizenship_cruise_passenger
				country = owner
			}
		}

		if = {
			limit = {
				divinity_right_to_work_job_check_trigger_exempt = no
			}
			divinity_right_to_work_job_check_trigger_specialist = yes
		}

	}
}

# Forever Cruise resource-aware LV job-priority governor
# Stateless by design: vanilla Operational Reserves supplies Energy/Mineral pressure,
# while Food/Consumer Goods/Alloy pressure uses a conservative low-and-falling check.
# ROOT = pop_group/job
lv_forever_cruise_governor_active = {

	exists = owner
	owner = {
		has_origin = origin_forever_cruise
		NOT = { has_country_flag = forever_cruise_over }
	}

}

# Energy and Minerals are a shared 1:1 Operational Reserves pool for Nomads
# ROOT = pop_group/job
lv_forever_cruise_governor_reserve_pressure = {

	lv_forever_cruise_governor_active = yes
	owner = {
		any_situation = {
			is_situation_type = situation_nomad_economy
			nomad_in_reserve_crisis = yes
		}
	}

}

# Secondary essential-resource pressure only fires when the stockpile is both low and falling
# ROOT = pop_group/job
lv_forever_cruise_governor_food_pressure = {

	lv_forever_cruise_governor_active = yes
	owner = {
		country_uses_food = yes
		resource_stockpile_compare = {
			resource = food
			value < 1000
		}
		has_monthly_income = {
			resource = food
			value < 0
		}
	}

}

# ROOT = pop_group/job
lv_forever_cruise_governor_consumer_goods_pressure = {

	lv_forever_cruise_governor_active = yes
	owner = {
		country_uses_consumer_goods = yes
		resource_stockpile_compare = {
			resource = consumer_goods
			value < 1000
		}
		has_monthly_income = {
			resource = consumer_goods
			value < 0
		}
	}

}

# ROOT = pop_group/job
lv_forever_cruise_governor_alloys_pressure = {

	lv_forever_cruise_governor_active = yes
	owner = {
		resource_stockpile_compare = {
			resource = alloys
			value < 1000
		}
		has_monthly_income = {
			resource = alloys
			value < 0
		}
	}

}

# Local Arkship/colony pressure
# This remains separate from country-wide resource pressure
# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_amenities_pressure = {

	lv_forever_cruise_governor_active = yes
	colony = { free_amenities < 0 }

}

# ROOT = pop_group/job (requires colony link through Amenities pressure)
lv_forever_cruise_governor_pressure = {

	OR = {
		lv_forever_cruise_governor_reserve_pressure = yes
		lv_forever_cruise_governor_food_pressure = yes
		lv_forever_cruise_governor_consumer_goods_pressure = yes
		lv_forever_cruise_governor_alloys_pressure = yes
		lv_forever_cruise_governor_amenities_pressure = yes
	}

}

# Service jobs stay competitive when they are directly repairing a local Amenities deficit
# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_suppress_amenity_job = {

	lv_forever_cruise_governor_pressure = yes
	lv_forever_cruise_governor_amenities_pressure = no

}

# Breeders are growth/assembly investments with heavy immediate upkeep, not crisis-solvers
# ROOT = pop_group/job (requires colony link through aggregate pressure)
lv_forever_cruise_governor_suppress_breeder = {

	lv_forever_cruise_governor_pressure = yes

}

# Stimulators directly produce Energy, which feeds Operational Reserves 1:1
# ROOT = pop_group/job (requires colony link through aggregate pressure)
lv_forever_cruise_governor_suppress_stimulator = {

	lv_forever_cruise_governor_pressure = yes
	lv_forever_cruise_governor_reserve_pressure = no

}

# Dairy is a solver only when its phenotype output is currently useful.
# Breeders policy makes Organic/Lithoid dairy resource-neutral, so those modes do not count as solvers.
# ROOT = pop_group/job
lv_forever_cruise_governor_dairy_solves_pressure = {

	OR = {
		AND = {
			lv_forever_cruise_governor_food_pressure = yes
			owner = { is_lithoid_or_infernal_empire = no }
			lv_milk_cows_policy_breeders_active_organic = no
		}
		AND = {
			lv_forever_cruise_governor_reserve_pressure = yes
			owner = { is_lithoid_empire = yes }
			lv_milk_cows_policy_breeders_active_lithoid = no
		}
		AND = {
			lv_forever_cruise_governor_alloys_pressure = yes
			owner = { is_infernal_empire = yes }
		}
	}

}

# ROOT = pop_group/job (requires colony link through aggregate pressure)
lv_forever_cruise_governor_suppress_dairy = {

	lv_forever_cruise_governor_pressure = yes
	lv_forever_cruise_governor_dairy_solves_pressure = no

}

# Gem Incubators solve Minerals/Reserves in Balanced or Minerals mode,
# and solve Alloy pressure in Balanced or Alloys mode.
# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_gem_incubator_solves_pressure = {

	OR = {
		AND = {
			lv_forever_cruise_governor_reserve_pressure = yes
			OR = {
				lv_gem_incubator_balanced_flag = yes
				lv_gem_incubator_minerals_flag = yes
			}
		}
		AND = {
			lv_forever_cruise_governor_alloys_pressure = yes
			OR = {
				lv_gem_incubator_balanced_flag = yes
				lv_gem_incubator_alloys_flag = yes
			}
		}
	}

}

# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_suppress_gem_incubator = {

	lv_forever_cruise_governor_pressure = yes
	lv_forever_cruise_governor_gem_incubator_solves_pressure = no

}

# Sexologists reliably solve Consumer Goods pressure only in the dedicated Consumer Goods focus
# Balanced focus can become net-negative after specialist upkeep on several swap types
# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_sexologist_solves_pressure = {

	lv_forever_cruise_governor_consumer_goods_pressure = yes
	lv_sexology_focus_consumer_goods_flag = yes

}

# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_suppress_sexologist = {

	lv_forever_cruise_governor_pressure = yes
	lv_forever_cruise_governor_sexologist_solves_pressure = no

}

# Experimenter Drones do not pay Consumer Goods upkeep, so Balanced and Consumer Goods focus
# both provide a positive Consumer Goods contribution.
# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_experimenter_solves_pressure = {

	lv_forever_cruise_governor_consumer_goods_pressure = yes
	OR = {
		lv_sexology_focus_balanced_flag = yes
		lv_sexology_focus_consumer_goods_flag = yes
	}

}

# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_suppress_experimenter = {

	lv_forever_cruise_governor_pressure = yes
	lv_forever_cruise_governor_experimenter_solves_pressure = no

}

# The Physicist Experimenter can additionally become an Extradimensional Research Unit,
# which directly produces Minerals and Alloys and therefore helps Reserve or Alloy pressure.
# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_experimenter_physicist_solves_pressure = {

	OR = {
		lv_forever_cruise_governor_experimenter_solves_pressure = yes
		AND = {
			OR = {
				lv_forever_cruise_governor_reserve_pressure = yes
				lv_forever_cruise_governor_alloys_pressure = yes
			}
			colony? = { physicist_is_extradimensional_research_unit_trigger = yes }
		}
	}

}

# ROOT = pop_group/job (requires colony link)
lv_forever_cruise_governor_suppress_experimenter_physicist = {

	lv_forever_cruise_governor_pressure = yes
	lv_forever_cruise_governor_experimenter_physicist_solves_pressure = no

}

# Job weights
# Agrarian idyll civic
# ROOT = pop_group/job
lv_job_weight_civic_agrarian_idyll = {

	owner? = { has_valid_civic = civic_agrarian_idyll }

}

# Non servant slaves
# ROOT = pop_group/job
lv_job_weight_enslaved_not_servant = {

	is_enslaved = yes
	can_take_servant_job = no

}

# Non servant robutts
# ROOT = pop_group/job
lv_job_weight_robot_not_servants = {

	OR = {
		is_non_sapient_robot = yes
		is_shackled_robot = yes
	}
	can_take_servant_job = no

}

# Non servant or specialists robutts
# ROOT = pop_group/job
lv_job_weight_robot_not_servants_or_specialist = {

	OR = {
		is_non_sapient_robot = yes
		is_shackled_robot = yes
	}
	can_take_servant_job = no
	can_fill_specialist_job_trigger = no

}

# Non-citizen non-mechanical Pop
# ROOT = pop_group/job
lv_job_weight_non_citizen_non_mechanical = {

	has_citizenship_rights = no
	NOT = { has_trait = trait_mechanical }

}

# Academic privilege
# ROOT = pop_group/job
lv_job_weight_academic_privilege = {

	has_living_standard = { type = living_standard_academic_privilege }

}

# Indentured slave
# ROOT = pop_group/job
lv_job_weight_indentured_slave = {

	is_enslaved = yes
	has_slavery_type = { type = slavery_indentured }

}

# Cyborg creed of research
# ROOT = pop_group/job
lv_job_weight_cyborg_creed_of_research = {

	has_trait = trait_cyborg_creed_of_research

}

# Low income modifier organic
# ROOT = pop_group/job
lv_job_weight_low_income_modifier_milk_cow_organic = {

	colony = { has_available_jobs = lv_dairy_milk_cow }

	exists = owner
	owner = {
		is_ai = yes
		is_lithoid_or_infernal_empire = no
		has_monthly_income = {
			resource = food
			value < 10
		}
	}

}

# Low income modifier lithoid
# ROOT = pop_group/job
lv_job_weight_low_income_modifier_milk_cow_lithoid = {

	colony = { has_available_jobs = lv_dairy_milk_cow }

	exists = owner
	owner = {
		is_ai = yes
		is_lithoid_empire = yes
		has_monthly_income = {
			resource = minerals
			value < 10
		}
	}

}

# Low income modifier infernal
# ROOT = pop_group/job
lv_job_weight_low_income_modifier_milk_cow_infernal = {

	colony = { has_available_jobs = lv_dairy_milk_cow }

	exists = owner
	owner = {
		is_ai = yes
		is_infernal_empire = yes
		has_monthly_income = {
			resource = alloys
			value < 10
		}
	}

}

# Food excess
# ROOT = pop_group/job
lv_job_weight_food_excess = {

	owner? = {
		has_monthly_income = {
			resource = food
			value > 50
		}
	}

}

# Energy excess
# ROOT = pop_group/job
lv_job_weight_energy_excess = {

	owner? = {
		has_monthly_income = {
			resource = energy
			value > 50
		}
	}

}

# Minerals excess
# ROOT = pop_group/job
lv_job_weight_minerals_excess = {

	owner? = {
		has_monthly_income = {
			resource = minerals
			value > 50
		}
	}

}

# Alloys excess
# ROOT = pop_group/job
lv_job_weight_alloys_excess = {

	owner? = {
		has_monthly_income = {
			resource = alloys
			value > 50
		}
	}

}

# Amenities shortage pleasure drone
# ROOT = pop_group/job
lv_job_weight_amenities_shortage_pleasure_drone = {

	colony = {
		free_amenities < 0
		has_available_jobs = lv_sex_pleasure_drone
	}

}

# Amenities shortage psi pleasure drone
# ROOT = pop_group/job
lv_job_weight_amenities_shortage_psi_pleasure_drone = {

	colony = {
		free_amenities < 0
		has_available_jobs = lv_sex_psi_pleasure_drone
	}

}

# Amenities shortage sexbot drone
# ROOT = pop_group/job
lv_job_weight_amenities_shortage_sexbot_drone = {

	colony = {
		free_amenities < 0
		has_available_jobs = lv_sex_sexbot_drone
	}

}

# Amenities shortage whore
# ROOT = pop_group/job
lv_job_weight_amenities_shortage_whore = {

	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

	colony = {
		free_amenities < 0
		has_available_jobs = lv_sex_whore
	}

}

# Amenities shortage psi_whore
# ROOT = pop_group/job
lv_job_weight_amenities_shortage_psi_whore = {

	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

	colony = {
		free_amenities < 0
		has_available_jobs = lv_sex_psi_whore
	}

}

# Amenities shortage sexbot
# ROOT = pop_group/job
lv_job_weight_amenities_shortage_sexbot = {

	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

	colony = {
		free_amenities < 0
		has_available_jobs = lv_sex_sexbot
	}

}

# Amenities shortage concubine
# ROOT = pop_group/job
lv_job_weight_amenities_shortage_concubine = {

	exists = owner
	owner = { NOT = { has_valid_civic = civic_dystopian_society } }

	colony = {
		free_amenities < 0
		has_available_jobs = lv_sex_concubine
	}

}

# Robutt empire less priority
# ROOT = pop_group/job
lv_job_weight_is_robutt_empire = {

	owner? = { is_robot_empire = yes }

}

# Is megacorp
# ROOT = pop_group/job
lv_job_weight_is_megacorp = {

	exists = owner
	owner = { is_megacorp = yes }

}

# Is fallen empire
# ROOT = pop_group/job
lv_job_weight_is_fallen_empire = {

	exists = owner
	owner = { is_fallen_empire = yes }

}

# Early machine assimilator priority
# ROOT = pop_group/job
lv_job_weight_machine_assimilator_early = {

	exists = owner
	years_passed < 1
	owner = { has_valid_civic = civic_machine_assimilator }
	has_trait = trait_cybernetic

}

# Does not use food
# ROOT = pop_group/job
lv_job_weight_does_not_use_food = {

	owner? = {
		country_uses_food = no
		has_monthly_income = {
			resource = food
			value >= 0
		}
	}

}

# Progenitor Hive origin
# ROOT = pop_group/job
lv_job_weight_has_progenitor_hive_origin = {

	exists = owner
	owner = {
		has_origin = origin_progenitor_hive
	}

}

# Population control gestalt
# ROOT = pop_group/job
lv_job_weight_population_control_gestalt = {

	colony = { has_modifier = planet_population_control_gestalt }

}

# Crisis purge
# ROOT = pop_group/job
lv_job_weight_crisis_purge = {

	colony.controller? = {
		OR = {
			is_country_type = swarm
			is_country_type = ai_empire
		}
	}

}

# Cyborg creed of construction trait
# ROOT = pop_group/job
lv_job_weight_cyborg_creed_of_construction_trait = {

	has_trait = trait_cyborg_creed_of_construction

}

# Robutt with domestic protocols trait
# ROOT = pop_group/job
lv_job_weight_domestic_protocols = {

	has_trait = trait_robot_domestic_protocols

}

# Artistic boom
# ROOT = pop_group/job
lv_job_weight_artistic_boom = {

	colony? = { has_modifier = artistic_boom }

}

# Willing apprentices first
# ROOT = pop_group/job
lv_job_weight_willing_apprentices_first = {

	has_citizenship_rights = no
	NOT = { has_trait = trait_mechanical }

}

# Psionic check
# ROOT = pop_group/job
lv_job_weight_is_psionic = {

	OR = {
		has_trait = trait_psionic
		has_trait = trait_latent_psionic
	}

}

# Has equine penis
# ROOT = pop_group/job
lv_job_weight_has_equine_penis = {

	has_trait = trait_lv_equine_penis

}

# Dairy weight
# Low
# ROOT = pop_group/job
lv_dairy_weight_low = {

	OR = {
		has_trait = trait_lv_honey
		has_trait = trait_lv_natural_anal_lube
		has_trait = trait_lv_neuron_saliva
		has_trait = trait_lv_aphrodisiac_milk
		has_trait = trait_lv_drooling_vagina
		has_trait = trait_lv_synth_breasts
		has_trait = trait_lv_sex_bots
		has_trait = trait_lv_sex_bots_o
	}

}

# Medium
# ROOT = pop_group/job
lv_dairy_weight_med = {

	OR = {
		has_trait = trait_lv_exotic_honey
		has_trait = trait_lv_excess_estrogen
		has_trait = trait_lv_large_breasts
		has_trait = trait_lv_multiple_breasts
		has_trait = trait_lv_perfect_hybrid
	}

}

# High
# ROOT = pop_group/job
lv_dairy_weight_high = {

	OR = {
		has_trait = trait_lv_huge_breasts
		has_trait = trait_lv_fuckable_nipples
		has_trait = trait_lv_high_volume_lactation
		has_trait = trait_lv_highly_nutritious_milk
		has_trait = trait_lv_fizzy_milk
		has_trait = trait_lv_titanic_evolution
		has_trait = trait_lv_prize_cow
		has_trait = trait_lv_femboy
	}

}

# Negative
# ROOT = pop_group/job
lv_dairy_weight_neg = {

	OR = {
		has_trait = trait_lv_small_breasts
		has_trait = trait_lv_watery_milk
	}

}

# Sex weight
# Low
# ROOT = pop_group/job
lv_sex_weight_low = {

	OR = {
		has_trait = trait_lv_soft
		has_trait = trait_lv_masochistic
		has_trait = trait_lv_nudist
		has_trait = trait_lv_honey
		has_trait = trait_lv_neuron_saliva
		has_trait = trait_lv_large_breasts
		has_trait = trait_lv_high_volume_lactation
		has_trait = trait_lv_futanari
		has_trait = trait_lv_nano_forge_womb
		has_trait = trait_lv_breast_augmenters_cyborg
		has_trait = trait_lv_maternal_programming
		has_trait = trait_lv_breast_attachments
		has_trait = trait_lv_custom_fleshlight_slot
		has_trait = trait_lv_custom_dildo_attachment
	}

}

# Medium
# ROOT = pop_group/job
lv_sex_weight_med = {

	OR = {
		has_trait = trait_lv_cute
		has_trait = trait_lv_sexual_pheromones
		has_trait = trait_lv_exotic_honey
		has_trait = trait_lv_elastic_orifices
		has_trait = trait_lv_long_tongues
		has_trait = trait_lv_huge_breasts
		has_trait = trait_lv_multiple_breasts
		has_trait = trait_lv_aphrodisiac_milk
		has_trait = trait_lv_shapely_ass
		has_trait = trait_lv_large_penis
		has_trait = trait_lv_high_volume_ejaculations
		has_trait = trait_lv_aphrodisiac_cum
		has_trait = trait_lv_addictive_cum
		has_trait = trait_lv_erogenous_anus
		has_trait = trait_lv_lewd_mind
		has_trait = trait_lv_brood_parasite
		has_trait = trait_lv_pheromone_generators_cyborg
		has_trait = trait_lv_pheromone_generators
	}

}

# High
# ROOT = pop_group/job
lv_sex_weight_high = {

	OR = {
		has_trait = trait_lv_sexually_gifted
		has_trait = trait_lv_targeted_pheromones
		has_trait = trait_lv_exhibitionist
		has_trait = trait_lv_natural_anal_lube
		has_trait = trait_lv_fuckable_nipples
		has_trait = trait_lv_fizzy_milk
		has_trait = trait_lv_drooling_vagina
		has_trait = trait_lv_breeder_hips
		has_trait = trait_lv_huge_penis
		has_trait = trait_lv_multiple_penises
		has_trait = trait_lv_sex_crazed
		has_trait = trait_lv_perfect_hybrid
		has_trait = trait_lv_titanic_evolution
		has_trait = trait_lv_prize_cow
		has_trait = trait_lv_femboy
		has_trait = trait_lv_lushtech_synthetic_womb_cyborg
		has_trait = trait_lv_synth_breasts_cyborg
		has_trait = trait_lv_synth_vagina_cyborg
		has_trait = trait_lv_sex_dolls_cyborg
		has_trait = trait_lv_lushtech_omni_seed_fabrication_modules_cyborg
		has_trait = trait_lv_synth_breasts
		has_trait = trait_lv_synth_vagina
		has_trait = trait_lv_lushtech_synthetic_womb
		has_trait = trait_lv_sex_bots
		has_trait = trait_lv_sex_bots_o
		has_trait = trait_lv_lushtech_omni_seed_fabrication_modules
	}

}

# Negative
# ROOT = pop_group/job
lv_sex_weight_neg = {

	OR = {
		has_trait = trait_lv_sadistic
		has_trait = trait_lv_seasonal_breeders
		has_trait = trait_lv_sexually_inept
		has_trait = trait_lv_sexually_repressed
		has_trait = trait_lv_small_penis
	}

}

# Breeding weight
# Low
# ROOT = pop_group/job
lv_breeding_weight_low = {

	OR = {
		has_trait = trait_lv_soft
		has_trait = trait_lv_masochistic
		has_trait = trait_lv_nudist
		has_trait = trait_lv_honey
		has_trait = trait_lv_neuron_saliva
		has_trait = trait_lv_large_breasts
		has_trait = trait_lv_high_volume_lactation
		has_trait = trait_lv_futanari
		has_trait = trait_lv_nano_forge_womb
		has_trait = trait_lv_breast_attachments
		has_trait = trait_lv_custom_fleshlight_slot
		has_trait = trait_lv_custom_dildo_attachment
	}

}

# Medium
# ROOT = pop_group/job
lv_breeding_weight_med = {

	OR = {
		has_trait = trait_lv_cute
		has_trait = trait_lv_sexual_pheromones
		has_trait = trait_lv_exhibitionist
		has_trait = trait_lv_exotic_honey
		has_trait = trait_lv_elastic_orifices
		has_trait = trait_lv_natural_anal_lube
		has_trait = trait_lv_long_tongues
		has_trait = trait_lv_huge_breasts
		has_trait = trait_lv_multiple_breasts
		has_trait = trait_lv_fizzy_milk
		has_trait = trait_lv_aphrodisiac_milk
		has_trait = trait_lv_drooling_vagina
		has_trait = trait_lv_shapely_ass
		has_trait = trait_lv_large_penis
		has_trait = trait_lv_high_volume_ejaculations
		has_trait = trait_lv_aphrodisiac_cum
		has_trait = trait_lv_addictive_cum
		has_trait = trait_lv_lewd_mind
		has_trait = trait_lv_brood_parasite
		has_trait = trait_lv_pheromone_generators
		has_trait = trait_lv_synth_breasts
		has_trait = trait_lv_lushtech_omni_seed_fabrication_modules
	}

}

# High
# ROOT = pop_group/job
lv_breeding_weight_high = {

	OR = {
		has_trait = trait_lv_sexually_gifted
		has_trait = trait_lv_targeted_pheromones
		has_trait = trait_lv_fuckable_nipples
		has_trait = trait_lv_litters
		has_trait = trait_lv_breeder_hips
		has_trait = trait_lv_huge_penis
		has_trait = trait_lv_multiple_penises
		has_trait = trait_lv_sex_crazed
		has_trait = trait_lv_perfect_hybrid
		has_trait = trait_lv_titanic_evolution
		has_trait = trait_lv_prize_cow
		has_trait = trait_lv_femboy
		has_trait = trait_lv_synth_vagina
		has_trait = trait_lv_lushtech_synthetic_womb
		has_trait = trait_lv_sex_bots
		has_trait = trait_lv_sex_bots_o
	}

}

# Negative
# ROOT = pop_group/job
lv_breeding_weight_neg = {

	OR = {
		has_trait = trait_lv_sadistic
		has_trait = trait_lv_erogenous_anus
		has_trait = trait_lv_seasonal_breeders
		has_trait = trait_lv_sexually_inept
		has_trait = trait_lv_sexually_repressed
		has_trait = trait_lv_small_penis
	}

}

# Traditions
# Orgasmic lactation cum check organic
# ROOT = pop_group/job
lv_orgasmic_lactation_has_cum_supply_organic = {

	exists = owner
	owner = {
		is_lithoid_or_infernal_empire = no
		has_tradition = tr_lv_milking_3_orgasmic_lactation
	}

	OR = {
		AND = {
			exists = planet
			planet = { lv_beasties_on_planet = yes }
		}
		colony = { lv_has_equine_pop = yes }
	}

}

# Orgasmic lactation cum check lithoid
# ROOT = pop_group/job
lv_orgasmic_lactation_has_cum_supply_lithoid = {

	exists = owner
	owner = {
		is_lithoid_empire = yes
		has_tradition = tr_lv_milking_3_orgasmic_lactation
	}

	OR = {
		AND = {
			exists = planet
			planet = { lv_beasties_on_planet = yes }
		}
		colony = { lv_has_equine_pop = yes }
	}

}

# Orgasmic lactation cum check infernal
# ROOT = pop_group/job
lv_orgasmic_lactation_has_cum_supply_infernal = {

	exists = owner
	owner = {
		is_infernal_empire = yes
		has_tradition = tr_lv_milking_3_orgasmic_lactation
	}

	OR = {
		AND = {
			exists = planet
			planet = { lv_beasties_on_planet = yes }
		}
		colony = { lv_has_equine_pop = yes }
	}

}

# Orgasmic lactation no cum supply organic
# ROOT = pop_group/job
lv_orgasmic_lactation_no_cum_supply_organic = {

	exists = owner
	owner = {
		is_lithoid_or_infernal_empire = no
		has_tradition = tr_lv_milking_3_orgasmic_lactation
	}

	NOR = {
		AND = {
			exists = planet
			planet = { lv_beasties_on_planet = yes }
		}
		colony = { lv_has_equine_pop = yes }
	}

}

# Orgasmic lactation no cum supply lithoid
# ROOT = pop_group/job
lv_orgasmic_lactation_no_cum_supply_lithoid = {

	exists = owner
	owner = {
		is_lithoid_empire = yes
		has_tradition = tr_lv_milking_3_orgasmic_lactation
	}

	NOR = {
		AND = {
			exists = planet
			planet = { lv_beasties_on_planet = yes }
		}
		colony = { lv_has_equine_pop = yes }
	}

}

# Orgasmic lactation no cum supply infernal
# ROOT = pop_group/job
lv_orgasmic_lactation_no_cum_supply_infernal = {

	exists = owner
	owner = {
		is_infernal_empire = yes
		has_tradition = tr_lv_milking_3_orgasmic_lactation
	}

	NOR = {
		AND = {
			exists = planet
			planet = { lv_beasties_on_planet = yes }
		}
		colony = { lv_has_equine_pop = yes }
	}

}

# Is a cyborg
# ROOT = pop_group/job
lv_is_a_cyborg = {

	OR = {
		has_trait = trait_limited_cybernetic
		has_trait = trait_cybernetic
	}

}

###################
# Pop Group Scope #
###################

# Direct Pop Group trait helpers


# Submissive check
# ROOT = pop_group
lv_is_submissive = {

	OR = {
		has_trait = trait_lv_submissive
		has_trait = trait_lv_prize_cow
	}

}

# Masochistic check
# ROOT = pop_group
lv_is_masochistic = {

	OR = {
		has_trait = trait_lv_masochistic
		has_trait = trait_lv_prize_cow
	}

}

###